<include file="Public:header" />
<div class="container">
  <div class="mainbody"> <include file="Public:mallmenu" />
    <div class="rig_lm03">
      <div class="title" ><img src="{$Think.config.static_path}images/listicon.jpg" class="icon" >
        <h2>商品列表</h2>
        <form method="POST" action="" style="margin-left:100px;">
          <input type="text"  class="searcheTxt" placeholder="请输入商品名称/商品编号" name="keys" id="keys" value="<?php echo $_REQUEST['keys']?>">
          <button type="button" onclick="changeSelect()" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-search"></span> 搜索</button>
        </form>
        <p class="text-right function">
          <a href="__URL__/addproduct" class="btn btn-info btn-sm" title="新增商品"><span class="glyphicon glyphicon-plus"></span> 新增商品</a> </p>
      </div>
      <div class="detail">
        <div id="tabCot_product_1" class="tabCot" >
          <table cellspacing="0" cellpadding="0" width="100%" border="0" class="tabindex table-hover">
            <tbody>
              <tr>
			    <th>编号</th>
                <th>商品名</th>
                <th>价格</th>
                <th>积分</th>
               
                <th>总库存/剩余库存</th>
				 <th>置顶</th>
				<th>状态</th>
                <th style="width:200px;">操作</th>
               
              </tr>
              <volist name="list" id="vo">
                <tr>
				  <td>{$vo.id}</td>
                  <td >
                   {$vo.title}
                  </td>
                  <td>{$vo.price}</td>
                  <td>{$vo.score}</td>
                 
                  <td>{$vo.total}/{$vo['sale_toal'] == 0?$vo['total']:$vo['sale_toal']}</td>
				   <td>{$vo['top'] == 1?'是':'否'}</td>
                  <td>
					{$vo['status'] == 1?'上架':'下架'}</td>
					<td>
				 
                  <a href="__URL__/addproduct?id={$vo.id}" title="编辑">编辑</a>&nbsp;|&nbsp;
                  <a href="javascript:confirmDelete({$vo.id})"  name="{$vo.title}" title="删除">删除</a></td>
                </tr>
              </volist>
            </tbody>
          </table>
          
          <div class="manu">
                        {$page}
                </div>
        </div>
      </div>
    </div>
  </div>
</div>
<include file="Public:footer" /> 
<script type="text/javascript">
$(function(){
	$('#sproduct').addClass('rig_seleli');
	$("tr:odd").addClass("even");
	$("tr:even").addClass("odd");
	});
	
function changeSelect() {
	var keys = $('#keys').val();
	var userType = $('#userType').val();
    location.href = "__URL__/userList?keys=" + keys+"&userType="+userType+"&id=<?php echo $_GET['id']?>" ;
}


function confirmDelete(id){
if (confirm("确认要删除这条数据吗？")) {
       location.href="__URL__/delete?id="+id;
     }
}

function setUserOrder(id){
	var gorder = $('#gorder_'+id).val();
	$.ajax({

             type: "GET",

             url: "__URL__/setUserOrder?id="+id+"&gorder="+gorder,

             data: '',

             dataType: "json",

             success: function(data){
				location.replace(location.href);
                  }
		
         });
}

</script>